<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('openid', 100)->unique();
            $table->string('nickname', 50);
            $table->string('avatar', 255);
            $table->decimal('total_score', 10, 2)->default(0);
            $table->integer('win_count')->default(0);
            $table->integer('lose_count')->default(0);
            $table->integer('create_time');
            $table->integer('last_login_time')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}